package com.salton123.charging.bean;

import com.salton123.charging.Consts;

public class SoundItem {
    private int id;
    private boolean isOnline;
    private boolean isPlaying;
    private boolean isResId;
    private String name;
    private String url;

    public SoundItem(int i, String str, String str2, boolean z, boolean z2) {
        this.id = i;
        this.name = str;
        this.url = str2.replaceFirst(".*/master", Consts.SERVER);
        this.isResId = z;
        this.isOnline = z2;
    }

    public int getId() {
        return this.id;
    }

    public void setId(int i) {
        this.id = i;
    }

    public boolean isOnline() {
        return this.isOnline;
    }

    public void setOnline(boolean z) {
        this.isOnline = z;
    }

    public boolean isPlaying() {
        return this.isPlaying;
    }

    public void setPlaying(boolean z) {
        this.isPlaying = z;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String str) {
        this.name = str;
    }

    public String getUrl() {
        return this.url;
    }

    public void setUrl(String str) {
        this.url = str;
    }

    public boolean isResId() {
        return this.isResId;
    }

    public void setResId(boolean z) {
        this.isResId = z;
    }

    public static SoundItem from(LocalSoundItem localSoundItem) {
        return new SoundItem(localSoundItem.getId(), localSoundItem.getName(), localSoundItem.getUri(), localSoundItem.isResId(), false);
    }

    public static SoundItem from(OnlineSoundList.OnlineSoundItem onlineSoundItem) {
        return new SoundItem(9999, onlineSoundItem.getName(), onlineSoundItem.getUrl(), false, true);
    }
}
